package com.wxb.cardmis.controller;

import com.wxb.cardmis.entity.UserEntity;
import com.wxb.cardmis.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

/**
 * All rights Reserved, Designed By www.super-master.cn
 *
 * @ProjectName: cardmis
 * @Package: com.wxb.cardmis.controller
 * @ClassName: UserController
 * <p> </p>
 * @Author: [Wei Xiao]
 * @Date: 2022/2/21 23:04
 * @Version: V1.0
 * @Copyright: 2022  com.wei All rights reserved.
 * TODO: 注意,本文件Wei Xiao所作,如果转载或使用请标明具体出处!
 * @Date: 2022年02月21日 23:04
 * @Description: []
 **/
@RestController
@CrossOrigin
public class UserController {
    @Autowired
    private UserService userService;
    @CrossOrigin
    @PostMapping("cardmis/register")
    public String register(@RequestBody UserEntity userEntity){
        return userService.register(userEntity);
    }

    @CrossOrigin
    @PostMapping("cardmis/login")
    public String login(@RequestBody UserEntity requestUser, HttpSession session){
         return userService.login(requestUser,session);
    }
    @CrossOrigin
    @GetMapping("cardmis/get")
    public UserEntity get(){
        return userService.getAuser();
    }

}
